package CF.BridgeRenovation;

import java.util.Scanner;

public class Main {
    static int min = Integer.MAX_VALUE;
    static int[][] chance = {{-1, 0, -1}, {-1, -2, 0}, {0, -1, -1}};
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = {n, n, n};
        dfs(arr, 0);
        System.out.println(min);
    }
    static void dfs(int[] arr, int n) {
        if(n > min) {
            return;
        }
        if(arr[0] <= 0 && arr[1] <= 0 && arr[2] <= 0) {
            min = Math.min(min, n);
            return;
        }
        for(int[] a: chance) {
            if(arr[0] > 0 && arr[1] < 0 && arr[2] < 0 && a[0] == 0) {
                continue;
            }
            if(arr[0] < 0 && arr[1] > 0 && arr[2] < 0 && a[1] == 0) {
                continue;
            }
            if(arr[0] < 0 && arr[1] < 0 && arr[2] > 0 && a[2] == 0) {
                continue;
            }
            System.out.println((arr[0] + a[0]) + " " + (arr[1] + a[1]) + " " + (arr[2] + a[2]));
            dfs(new int[]{arr[0] + a[0], arr[1] + a[1], arr[2] + a[2]}, n + 1);
        }
    }
}
